package alert

import (
	"context"
	"time"
)

// Service 告警服务接口
type Service interface {
	// 处理告警规则
	HandleAlert(ctx context.Context, alert *Alert) error
	// 获取告警历史
	GetAlertHistory(ctx context.Context, filter AlertFilter) ([]*AlertHistory, error)
	// 更新告警规则
	UpdateAlertRule(ctx context.Context, rule *AlertRule) error
	// 发送告警消息
	SendAlert(level string, title string, content string) error
}

// Alert 告警信息
type Alert struct {
	ID        string
	Level     string
	Title     string
	Content   string
	Timestamp time.Time
	Source    string
	Tags      map[string]string
}

// AlertHistory 告警历史
type AlertHistory struct {
	Alert
	Status    string
	SendTime  time.Time
	Receivers []string
}

// AlertFilter 告警历史查询过滤器
type AlertFilter struct {
	StartTime time.Time
	EndTime   time.Time
	Level     string
	Source    string
}

// AlertRule 告警规则
type AlertRule struct {
	ID      string
	Name    string
	Level   string
	Source  string
	Enabled bool
}

// 确保 WeComAlertService 实现了 Service 接口
var _ Service = (*WeComAlertService)(nil)
